package com.sky.controller.user;

import com.sky.pojo.Merchant;
import com.sky.result.Result;
import com.sky.service.MerchantService;
import com.sky.vo.ShopVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user/shop")
public class UserShopController {

    @Autowired
    private MerchantService merchantService;

    @ApiOperation("查询商家信息")
    @GetMapping("/getMerchantInfo")
    public Result getMerchantInfo() {

        Merchant merchant = merchantService.getShopById(1L);
        String  shopName = merchant.getShopName();
        String  shopAddress = merchant.getShopAddress();
        String  shopTelephone = merchant.getShopTelephone();
        ShopVO build = ShopVO.builder().phone(shopTelephone).shopName(shopName).shopAddress(shopAddress).build();

        return Result.success(build);
    }
}
